-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: reduce the number of decimals shown for simulation detail amounts #24036
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
ui/pages/confirmations/components/simulation-details/amount-pill.tsx
Outdated
Show resolved
Hide resolved
ui/pages/confirmations/components/simulation-details/formatAmount.ts
Outdated
Show resolved
Hide resolved
ui/pages/confirmations/components/simulation-details/simulation-details.tsx
Show resolved
Hide resolved
Builds ready [93843bd]
Page Load Metrics (1489 ± 761 ms)
Bundle size diffs
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #24036 +/- ##
===========================================
+ Coverage 67.47% 67.48% +0.01%
===========================================
Files 1257 1259 +2
Lines 49227 49239 +12
Branches 12822 12826 +4
===========================================
+ Hits 33215 33227 +12
Misses 16012 16012 ☔ View full report in Codecov by Sentry. |
Builds ready [ee0d144]
Page Load Metrics (1098 ± 646 ms)
Bundle size diffs
|
Builds ready [1086855]
Page Load Metrics (1586 ± 738 ms)
Bundle size diffs
|
Builds ready [85924bc]
Page Load Metrics (969 ± 592 ms)
Bundle size diffs
|
Description
This PR does two things:
|amount| < 1
: We display a maximum of 3 significant digits.|amount| >= 1
: We display all digits left of the decimal point. We also display some decimal places for smaller amounts, and gradually reduce the decimal precision as the amount gets bigger until we only show whole numbers.Users are still able to see the original amount, subject to the maximum precision supported by
Intl.NumberFormat
.Here is how different amounts are rendered:
Related issues
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/2343
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist